﻿namespace _02.BankExersice.Customers
{
    using System;

    public class IndividualCustomer : Customer
    {
        private string egn;

        public IndividualCustomer(string name, string egn, string phoneNumber)
            : base(name, phoneNumber)
        {
            this.Egn = egn;
        }

        public string Egn
        {
            get
            {
                return this.egn;
            }

            set
            {
                if (value == null)
                {
                    throw new ArgumentNullException();
                }
                else if (value.Equals(string.Empty))
                {
                    throw new FormatException();
                }
                else if (value.Length != 10)
                {
                    throw new FormatException();
                }

                this.egn = value;
            }
        }
    }
}
